package ;

import flash.Lib;
import flash.display.Sprite;
import flash.display.Bitmap;
import flash.geom.Point;
import openfl.Assets;
import motion.Actuate;
import motion.easing.Linear;
import flash.events.MouseEvent;

/**
 * ...
 * @author test
 */

//TODO: This is, clearly, a test and therefore must be reviewed in depth.

//Simple player class that, by now, only allows to drag him around the stage.
class Player extends Sprite {
	//The player bitmap.
	//TODO: Change to proper animation class.
	private var bitmap:Bitmap;

	//Getters and setters - BEGIN
	private function getBitmap():Bitmap {
		return this.bitmap;
	}
	//Getters and setters - END

	//Constructor... nothing else to say here.
	public function new() {
		super();
		this.x = 160;
		this.y = 240;

		this.bitmap = new Bitmap(Assets.getBitmapData("images/player.png"));
		this.addChild(this.bitmap);

		this.addEventListener(MouseEvent.MOUSE_DOWN, this.onMouseDown);
		this.addEventListener(MouseEvent.MOUSE_UP,this.onMouseUp);
	}

	//Method bound to event MOUSE_DOWN.
	private function onMouseDown(event:MouseEvent):Void {
		this.startDrag();
	}

	//Method bound to event MOUSE_UP.
	private function onMouseUp(event:MouseEvent):Void {
		this.stopDrag();
	}
}